package com.tzbank.wisdom.controller;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.tzbank.wisdom.service.BusinessService;
import com.tzbank.wisdom.service.CommonService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

/**
 * 公共控制器
 *
 */
@Slf4j
@Api(tags={"公共"})
@RestController
@RequestMapping(value = "/common")
public class CommonController {
	
	@Resource
    private BusinessService businessService;
	
	@Resource
    private CommonService commonService;
    
	/**
	 * 主题接口
	 * @param themeId
	 * @return
	 */
	@PostMapping(value = "/theme")
    @ApiOperation(value = "主题接口", notes = "主题接口")
    @ApiImplicitParams({ @ApiImplicitParam(name = "themeId", value = "themeId主题id") })
    public Map<String,Object> traditionTransfer(@RequestBody Map<String,String> paramsMap) {
		log.info("入参："+JSONObject.toJSONString(paramsMap));
    	return businessService.theme(paramsMap);
    }
    
	
	/**
	 * 发送短信动态码
	 * @param paramsMap
	 * @return
	 */
    @ResponseBody
    @PostMapping(value="/sendCodeMsg")
    @ApiOperation(value = "发送短信动态码", notes = "发送短信动态码接口")
    public Map<String,Object> sendCodeMsg(@RequestBody Map<String,String> paramsMap) {
    	log.info("入参："+JSONObject.toJSONString(paramsMap));
    	return commonService.sendCodeMsg(paramsMap);
    }
    
    /**
	 * 校验短信动态
	 * @param paramsMap
	 * @return
	 */
    @ResponseBody
    @PostMapping(value="/verifyCode")
    @ApiOperation(value = "校验短信动态", notes = "校验短信动态接口")
    public Map<String,Object> verifyCode(@RequestBody Map<String,String> paramsMap) {
    	log.info("入参："+JSONObject.toJSONString(paramsMap));
    	return commonService.verifyCode(paramsMap);
    }
    
    
    /**
   	 * 校验交易密码
   	 * @param paramsMap
   	 * @return
   	 */
    @ResponseBody
    @PostMapping(value="/verifyTransPassword")
    @ApiOperation(value = "校验交易密码", notes = "校验交易密码接口")
    public Map<String,Object> verifyTransPassword(@RequestBody Map<String,String> paramsMap) {
   	 log.info("入参："+JSONObject.toJSONString(paramsMap));
   	 return commonService.verifyTransPassword(paramsMap);
    }
}
